feat: vanilla fresnel - #243
Conversation
Squash of upstream PR community-shaders#2332 (jiayev, head 506488a) applied to origin/dev. Pure upstream content; the only local edits are trivial conflict resolutions in the feature registration lists (Feature.cpp include, FeatureBuffer.cpp pack order, Globals.cpp includes) against fork-only features. Adds the Vanilla Fresnel core feature: environmental reflections for vanilla and complex materials, optional GGX specular conversion and dynamic cubemap conversion. New always-on VANILLA_FRESNEL shader define invalidates the shader disk cache (full cold recompile). Co-Authored-By: Jiaye <l936249247@hotmail.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0183vd8arYzymdQi94eqpctT
Fork adaptation on top of the upstream community-shaders#2332 squash. All feature shader terms derive from the per-eye viewDirection/context.viewDir, the IsEye descriptor uses the existing permutationData path shared with VR, and the SetupGeometry hook is a vtable write with no address-library dependency, so no VR divergence is required beyond the SupportsVR flag. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0183vd8arYzymdQi94eqpctT
|
Warning Review limit reached
Next review available in: 3 seconds Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (17)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
No actionable suggestions for changed features. |
There was a problem hiding this comment.
Pull request overview
Integrates upstream “Vanilla Fresnel” to add environment-reflection/Fresnel behavior to vanilla + complex materials, with optional Phong→GGX specular conversion (including grass) and optional dynamic-cubemap conversion, plus a VR enablement override and required shader/permutation plumbing.
Changes:
- Added a new core feature (
VANILLA_FRESNEL) with settings, registration, and a lighting shader hook that tags eye materials via a new permutation bit. - Extended shared feature constant-buffer packing and shader
SharedDatato carry Vanilla Fresnel settings. - Updated lighting/grass shaders to support GGX specular paths, EnvBRDF-based reflectance, and eye-material special handling.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/State.h | Adds IsEye to extra shader descriptor flags for new eye-material permutation. |
| src/Globals.h | Declares global vanillaFresnel feature instance. |
| src/Globals.cpp | Defines/initializes global vanillaFresnel feature instance and includes header. |
| src/Features/VanillaFresnel.h | Introduces the new core feature interface + settings struct. |
| src/Features/VanillaFresnel.cpp | Implements settings serialization, UI, and a BSLightingShader vfunc hook to set IsEye. |
| src/FeatureBuffer.cpp | Adds Vanilla Fresnel settings to packed feature constant buffer (b6). |
| src/Feature.cpp | Registers Vanilla Fresnel in the feature list. |
| package/Shaders/RunGrass.hlsl | Updates grass deferred outputs and lighting/specular paths to support Fresnel/GGX options. |
| package/Shaders/Lighting.hlsl | Adds Fresnel-derived F0/roughness logic, eye handling, and cubemap conversion behavior in lighting. |
| package/Shaders/Common/SharedData.hlsli | Adds VanillaFresnelSettings to the shared feature cbuffer layout. |
| package/Shaders/Common/Permutation.hlsli | Adds IsEye bit to match C++ permutation descriptors. |
| package/Shaders/Common/LightingEval.hlsli | Adds microfacet (GGX) specular evaluation path gated by Vanilla Fresnel settings. |
| features/Vanilla Fresnel/Shaders/Features/VanillaFresnel.ini | Adds the feature shader INI metadata/version. |
| features/Vanilla Fresnel/CORE | Marks feature as CORE so AIO bundles include its shaders. |
| features/Grass Lighting/Shaders/GrassLighting/GrassLighting.hlsli | Extends grass specular helper to optionally use GGX/Fresnel inputs. |
| features/Grass Lighting/Shaders/Features/GrassLighting.ini | Bumps Grass Lighting shader feature version to reflect shader changes. |
|
✅ A pre-release build is available for this PR: |
Copilot review on #243: the upstream squash's new feature file hardcoded English UI strings and a raw category literal instead of this fork's T()/FeatureCategories conventions (upstream has no i18n system, so it never could have used them), and the packed Settings struct lacked the STATIC_ASSERT_ALIGNAS_16 check every other b6-buffer feature carries. Fixed to match the exact pattern in ExtendedMaterials/DynamicCubemaps. Two other Copilot findings were checked and NOT changed: - GrassLighting.hlsli's Vis_SmithJointApprox(roughness, NdotL, NdotV) looks argument-swapped against the function's (roughness, NdotV, NdotL) signature, but the approximation's Vis_SmithV+Vis_SmithL sum is symmetric in the two angles by construction; verified numerically that output is bit-identical either order. No bug. - DrawSettings() force-disables EnableDynamicCubemapsConversion when EnableGGX is off. This looked like an artificial UI restriction (the shader's indirect-specular path consumes the cubemap-derived F0/Roughness independent of EnableGGX), but jiayev's upstream history has a standalone commit titled "forbid cubemap conversion when not ggx" (498fa7d) deliberately adding this exact coupling. Confirmed intentional; left as upstream authored it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WFzp29R2ZAM2Xa93jk8TG7
CI check "Verify en.json is in sync with source" failed after the fork-standards commit added T() calls to VanillaFresnel.h/.cpp; en.json is generated (tools/extract-i18n.py --write) and must never be hand-edited. Regenerated, adding only the 17 new feature.vanilla_fresnel.* keys.
Summary
Integrates upstream community-shaders#2332
(Vanilla Fresnel by @jiayev) ahead of its upstream merge, structured for
easy reconciliation at the next upstream sync.
New core feature: environmental reflections for vanilla and complex
materials, optional Phong-to-GGX specular conversion (incl. grass), and
optional dynamic-cubemap conversion of static cubemaps.
Commit structure (reconciliation plan)
feat: vanilla fresnel (upstream #2332): pure squash of the upstreamPR head (506488a). The only local edits are trivial conflict
resolutions in the feature registration lists against fork-only
features (Feature.cpp include, FeatureBuffer.cpp pack order,
Globals.cpp includes).
feat(vr): enable Vanilla Fresnel in VR: the sole fork deviation, aSupportsVR() = trueoverride.Deviation list for the future upstream sync
When upstream squash-merges community-shaders#2332 and it arrives via the next tag sync,
the content should mostly auto-resolve as identical. Fork deviations to
re-apply (in the sync's fix(sync) commit) if conflicted:
SupportsVR()override insrc/Features/VanillaFresnel.h(+ thefork comment above it).
VR review
grass path) derive from the per-eye
viewDirection/context.viewDir;no screen-space or camera-global state, so no
#if defined(VR)needed.permutationData.ExtraShaderDescriptorpath (same pattern as SubsurfaceScattering's IsBeastRace, VR-proven).
write_vfunc<0x6>onVTABLE_BSLightingShader[0]) with no address-library dependency; sixexisting features hook the identical slot.
Notes
VANILLA_FRESNELdefine invalidates the shader diskcache: users get a full cold recompile on first launch.
Testing
ALLbuild green (pre- and post-rebase onto feat(vr): Performance hub with profiles #240).🤖 Generated with Claude Code
https://claude.ai/code/session_0183vd8arYzymdQi94eqpctT